import React, { useEffect } from 'react'
import { Layout } from 'antd'

const { Content } = Layout
export default function LuckySheetContent () {



  const defaultOption = {
    container: "luckysheet",
    lang: 'zh',
    showinfobar: false,
    allowEdit: true,//作用：是否允许前台编辑
    allowUpdate: true,

    loadUrl: {
      url: "http://localhost:8081/onlineOffice/getData",
      beforeSend: function (request) {
        request.setRequestHeader("satoken", localStorage.getItem("satoken"))
      }
    },
    updateUrl: "ws://127.0.0.1:8081/excelSocket/" + localStorage.getItem("username"),
    "gridKey": "1079500#-8803#7c45f52b7d01486d88bc53cb17dcd2c3",
  }


  // 在组件挂载时渲染
  useEffect(() => {
    window.luckysheet.create(defaultOption)
  }, [])

  //setInterval(function () { alert("Hello") }, 3000)


  // 报表样式
  const luckyCss = {
    margin: '0px',
    padding: '0px',
    position: 'relative',
    width: '100%',
    height: '100%',
    left: '0px'
  }
  return (
    <Content className="site-layout" style={{ padding: 0, height: '90%' }}>

      <div id='luckysheet' style={luckyCss}>

      </div>

    </Content>
  )
}
